import { IPSDataEntity } from '../dataentity/ipsdata-entity';
import { IPSDEField } from '../dataentity/defield/ipsdefield';
import { IPSSysMsgQueue } from './ipssys-msg-queue';
import { IPSSysSFPlugin } from '../res/ipssys-sfplugin';
import { IPSSystemModule } from '../system/ipssystem-module';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysMsgQueueImpl extends PSModelObjectImpl implements IPSSysMsgQueue {
  get codeName(): string {
    return this.M.codeName;
  }

  protected contentpsdefield: IPSDEField | null = null;

  getContentPSDEField(): IPSDEField | null {
    if (this.contentpsdefield != null) return this.contentpsdefield;
    const value = this.M.getContentPSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.contentpsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.contentpsdefield;
  }

  get contentPSDEField(): IPSDEField | null {
    return this.getContentPSDEField();
  }

  getContentPSDEFieldMust(): IPSDEField {
    const value = this.getContentPSDEField();
    if (value == null) {
      throw new Error('未指定消息内容值存储属性');
    }
    return value;
  }

  protected ddcontentpsdefield: IPSDEField | null = null;

  getDDContentPSDEField(): IPSDEField | null {
    if (this.ddcontentpsdefield != null) return this.ddcontentpsdefield;
    const value = this.M.getDDContentPSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.ddcontentpsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.ddcontentpsdefield;
  }

  get dDContentPSDEField(): IPSDEField | null {
    return this.getDDContentPSDEField();
  }

  getDDContentPSDEFieldMust(): IPSDEField {
    const value = this.getDDContentPSDEField();
    if (value == null) {
      throw new Error('未指定钉钉消息内容值存储属性');
    }
    return value;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  protected filepsdefield: IPSDEField | null = null;

  getFilePSDEField(): IPSDEField | null {
    if (this.filepsdefield != null) return this.filepsdefield;
    const value = this.M.getFilePSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.filepsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.filepsdefield;
  }

  get filePSDEField(): IPSDEField | null {
    return this.getFilePSDEField();
  }

  getFilePSDEFieldMust(): IPSDEField {
    const value = this.getFilePSDEField();
    if (value == null) {
      throw new Error('未指定文件值存储属性');
    }
    return value;
  }

  protected imcontentpsdefield: IPSDEField | null = null;

  getIMContentPSDEField(): IPSDEField | null {
    if (this.imcontentpsdefield != null) return this.imcontentpsdefield;
    const value = this.M.getIMContentPSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.imcontentpsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.imcontentpsdefield;
  }

  get iMContentPSDEField(): IPSDEField | null {
    return this.getIMContentPSDEField();
  }

  getIMContentPSDEFieldMust(): IPSDEField {
    const value = this.getIMContentPSDEField();
    if (value == null) {
      throw new Error('未指定即时消息内容值存储属性');
    }
    return value;
  }

  get memo(): string {
    return this.M.memo;
  }

  protected mobtaskurlpsdefield: IPSDEField | null = null;

  getMobTaskUrlPSDEField(): IPSDEField | null {
    if (this.mobtaskurlpsdefield != null) return this.mobtaskurlpsdefield;
    const value = this.M.getMobTaskUrlPSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.mobtaskurlpsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.mobtaskurlpsdefield;
  }

  get mobTaskUrlPSDEField(): IPSDEField | null {
    return this.getMobTaskUrlPSDEField();
  }

  getMobTaskUrlPSDEFieldMust(): IPSDEField {
    const value = this.getMobTaskUrlPSDEField();
    if (value == null) {
      throw new Error('未指定移动端任务操作路径值存储属性');
    }
    return value;
  }

  get msgQueueTag(): string {
    return this.M.msgQueueTag;
  }

  get msgQueueTag2(): string {
    return this.M.msgQueueTag2;
  }

  get msgQueueType(): 'RUNTIME' | 'DE' | 'USER' | 'USER2' {
    return this.M.msgQueueType;
  }

  protected msgtypepsdefield: IPSDEField | null = null;

  getMsgTypePSDEField(): IPSDEField | null {
    if (this.msgtypepsdefield != null) return this.msgtypepsdefield;
    const value = this.M.getMsgTypePSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.msgtypepsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.msgtypepsdefield;
  }

  get msgTypePSDEField(): IPSDEField | null {
    return this.getMsgTypePSDEField();
  }

  getMsgTypePSDEFieldMust(): IPSDEField {
    const value = this.getMsgTypePSDEField();
    if (value == null) {
      throw new Error('未指定消息类型值存储属性');
    }
    return value;
  }

  get name(): string {
    return this.M.name;
  }

  protected psdataentity: IPSDataEntity | null = null;

  getPSDataEntity(): IPSDataEntity | null {
    if (this.psdataentity != null) return this.psdataentity;
    const value = this.M.getPSDataEntity;
    if (value == null) {
      return null;
    }
    this.psdataentity = this.getPSModel4('dataentity.IPSDataEntity', value, 'getPSDataEntity') as IPSDataEntity;
    return this.psdataentity;
  }

  get psDataEntity(): IPSDataEntity | null {
    return this.getPSDataEntity();
  }

  getPSDataEntityMust(): IPSDataEntity {
    const value = this.getPSDataEntity();
    if (value == null) {
      throw new Error('未指定实体对象');
    }
    return value;
  }

  protected pssyssfplugin: IPSSysSFPlugin | null = null;

  getPSSysSFPlugin(): IPSSysSFPlugin | null {
    if (this.pssyssfplugin != null) return this.pssyssfplugin;
    const value = this.M.getPSSysSFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyssfplugin = this.getPSModel4('res.IPSSysSFPlugin', value, 'getPSSysSFPlugin') as IPSSysSFPlugin;
    return this.pssyssfplugin;
  }

  get psSysSFPlugin(): IPSSysSFPlugin | null {
    return this.getPSSysSFPlugin();
  }

  getPSSysSFPluginMust(): IPSSysSFPlugin {
    const value = this.getPSSysSFPlugin();
    if (value == null) {
      throw new Error('未指定后台扩展插件');
    }
    return value;
  }

  protected pssystemmodule: IPSSystemModule | null = null;

  getPSSystemModule(): IPSSystemModule | null {
    if (this.pssystemmodule != null) return this.pssystemmodule;
    const value = this.M.getPSSystemModule;
    if (value == null) {
      return null;
    }
    this.pssystemmodule = this.getPSModel4('system.IPSSystemModule', value, 'getPSSystemModule') as IPSSystemModule;
    return this.pssystemmodule;
  }

  get psSystemModule(): IPSSystemModule | null {
    return this.getPSSystemModule();
  }

  getPSSystemModuleMust(): IPSSystemModule {
    const value = this.getPSSystemModule();
    if (value == null) {
      throw new Error('未指定系统模块');
    }
    return value;
  }

  protected smscontentpsdefield: IPSDEField | null = null;

  getSMSContentPSDEField(): IPSDEField | null {
    if (this.smscontentpsdefield != null) return this.smscontentpsdefield;
    const value = this.M.getSMSContentPSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.smscontentpsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.smscontentpsdefield;
  }

  get sMSContentPSDEField(): IPSDEField | null {
    return this.getSMSContentPSDEField();
  }

  getSMSContentPSDEFieldMust(): IPSDEField {
    const value = this.getSMSContentPSDEField();
    if (value == null) {
      throw new Error('未指定短消息内容值存储属性');
    }
    return value;
  }

  protected sendtimepsdefield: IPSDEField | null = null;

  getSendTimePSDEField(): IPSDEField | null {
    if (this.sendtimepsdefield != null) return this.sendtimepsdefield;
    const value = this.M.getSendTimePSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.sendtimepsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.sendtimepsdefield;
  }

  get sendTimePSDEField(): IPSDEField | null {
    return this.getSendTimePSDEField();
  }

  getSendTimePSDEFieldMust(): IPSDEField {
    const value = this.getSendTimePSDEField();
    if (value == null) {
      throw new Error('未指定消息发送时间值存储属性');
    }
    return value;
  }

  protected statepsdefield: IPSDEField | null = null;

  getStatePSDEField(): IPSDEField | null {
    if (this.statepsdefield != null) return this.statepsdefield;
    const value = this.M.getStatePSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.statepsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.statepsdefield;
  }

  get statePSDEField(): IPSDEField | null {
    return this.getStatePSDEField();
  }

  getStatePSDEFieldMust(): IPSDEField {
    const value = this.getStatePSDEField();
    if (value == null) {
      throw new Error('未指定消息状态值存储属性');
    }
    return value;
  }

  protected tag2psdefield: IPSDEField | null = null;

  getTag2PSDEField(): IPSDEField | null {
    if (this.tag2psdefield != null) return this.tag2psdefield;
    const value = this.M.getTag2PSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.tag2psdefield = ipsdataentity.findPSDEField(value);
    }
    return this.tag2psdefield;
  }

  get tag2PSDEField(): IPSDEField | null {
    return this.getTag2PSDEField();
  }

  getTag2PSDEFieldMust(): IPSDEField {
    const value = this.getTag2PSDEField();
    if (value == null) {
      throw new Error('未指定消息标记2值存储属性');
    }
    return value;
  }

  protected tagpsdefield: IPSDEField | null = null;

  getTagPSDEField(): IPSDEField | null {
    if (this.tagpsdefield != null) return this.tagpsdefield;
    const value = this.M.getTagPSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.tagpsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.tagpsdefield;
  }

  get tagPSDEField(): IPSDEField | null {
    return this.getTagPSDEField();
  }

  getTagPSDEFieldMust(): IPSDEField {
    const value = this.getTagPSDEField();
    if (value == null) {
      throw new Error('未指定消息标记值存储属性');
    }
    return value;
  }

  protected tarpsdefield: IPSDEField | null = null;

  getTargetPSDEField(): IPSDEField | null {
    if (this.tarpsdefield != null) return this.tarpsdefield;
    const value = this.M.getTargetPSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.tarpsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.tarpsdefield;
  }

  get targetPSDEField(): IPSDEField | null {
    return this.getTargetPSDEField();
  }

  getTargetPSDEFieldMust(): IPSDEField {
    const value = this.getTargetPSDEField();
    if (value == null) {
      throw new Error('未指定目标标识值存储属性');
    }
    return value;
  }

  protected tartypepsdefield: IPSDEField | null = null;

  getTargetTypePSDEField(): IPSDEField | null {
    if (this.tartypepsdefield != null) return this.tartypepsdefield;
    const value = this.M.getTargetTypePSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.tartypepsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.tartypepsdefield;
  }

  get targetTypePSDEField(): IPSDEField | null {
    return this.getTargetTypePSDEField();
  }

  getTargetTypePSDEFieldMust(): IPSDEField {
    const value = this.getTargetTypePSDEField();
    if (value == null) {
      throw new Error('未指定目标类型值存储属性');
    }
    return value;
  }

  protected taskurlpsdefield: IPSDEField | null = null;

  getTaskUrlPSDEField(): IPSDEField | null {
    if (this.taskurlpsdefield != null) return this.taskurlpsdefield;
    const value = this.M.getTaskUrlPSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.taskurlpsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.taskurlpsdefield;
  }

  get taskUrlPSDEField(): IPSDEField | null {
    return this.getTaskUrlPSDEField();
  }

  getTaskUrlPSDEFieldMust(): IPSDEField {
    const value = this.getTaskUrlPSDEField();
    if (value == null) {
      throw new Error('未指定任务操作路径值存储属性');
    }
    return value;
  }

  protected titlepsdefield: IPSDEField | null = null;

  getTitlePSDEField(): IPSDEField | null {
    if (this.titlepsdefield != null) return this.titlepsdefield;
    const value = this.M.getTitlePSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.titlepsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.titlepsdefield;
  }

  get titlePSDEField(): IPSDEField | null {
    return this.getTitlePSDEField();
  }

  getTitlePSDEFieldMust(): IPSDEField {
    const value = this.getTitlePSDEField();
    if (value == null) {
      throw new Error('未指定消息标题值存储属性');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  protected wxcontentpsdefield: IPSDEField | null = null;

  getWXContentPSDEField(): IPSDEField | null {
    if (this.wxcontentpsdefield != null) return this.wxcontentpsdefield;
    const value = this.M.getWXContentPSDEField;
    if (value == null) {
      return null;
    }
    const ipsdataentity = this.getPSDataEntity();
    if (ipsdataentity != null) {
      this.wxcontentpsdefield = ipsdataentity.findPSDEField(value);
    }
    return this.wxcontentpsdefield;
  }

  get wXContentPSDEField(): IPSDEField | null {
    return this.getWXContentPSDEField();
  }

  getWXContentPSDEFieldMust(): IPSDEField {
    const value = this.getWXContentPSDEField();
    if (value == null) {
      throw new Error('未指定微信消息内容值存储属性');
    }
    return value;
  }

  get cls(): string {
    return 'PSSysMsgQueueImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'msg.IPSSysMsgQueue') return true;
    return super.instanceof(cls);
  }
}
